package com.ytjj.qmyx.admin.eunm;

import com.ytjj.qmyx.admin.model.response.ActivityTypeResponse;

import java.util.ArrayList;
import java.util.List;

/**
 *
 *
 * @Version: 1.0
 */
public enum ActivityTypeNameCode {

    ORDINARY_PRODUCT("ORDINARY_PRODUCT", "普通商品"),
    COMMON("", "普通商品"),
    ORDINARY("ORDINARY", "普通商品"),
    CASH_SCORE("CASH_SCORE", "兑换中心"),
    NEW_USER("NEW_USER", "新人立返"),
    NEW_PRO("NEW_PRO", "新品招募"),
    RETURN_CASH("RETURN_CASH", "平台返现"),
    OLD_FOR_NEW("OLD_FOR_NEW", "全民补贴"),
    GET_SCORE("GET_SCORE", "全额返"),
    SECKILL("SECKILL", "超级秒杀"),
    CASH_COUPON("CASH_COUPON", "红包抵扣"),
    SUBSIDY("SUBSIDY", "补贴"),
    SINGLE_HOT("SINGLE_HOT", "单品爆款"),
    RECHARGE_COUPON("RECHARGE_COUPON", "购物返话费"),
    RETURN_COUPON("RETURN_COUPON", "红包返现"),
    PAY_AFTER_USE("PAY_AFTER_USE", "先用后付"),
    ZERO_EVALUATION("ZERO_EVALUATION", "0元测评"),
    WALLET_DEDUCTION("WALLET_DEDUCTION", "钱包抵扣"),
    GROUP_WORK("GROUP_WORK", "拼团活动"),
    CHINA_GOLD("CHINA_GOLD", "中国黄金"),
    SHOPPING_CARD("SHOPPING_CARD", "购物卡"),
    GUESS_LIKE("GUESS_LIKE", "猜你喜欢"),
    LIVING_CENTER("LIVING_CENTER","9.9生活馆"),
    MEMBER_SALE("MEMBER_SALE", "会员特卖"),
    MEMBER_SUBSIDY("MEMBER_SUBSIDY", "会员享补贴"),
    WALLET_DEDUCT("WALLET_DEDUCT", "钱包抵扣"),
    EXCLUSIVE_TRIAL("EXCLUSIVE_TRIAL", "专属试用"),
    DISCOUNTS_TRIAL_ACTIVITY("DISCOUNTS_TRIAL_ACTIVITY","优惠试用活动"),
    FROM_APP("FROM_APP","APP移除"),
    SHOPPING_CARNIVAL("SHOPPING_CARNIVAL","购物狂欢节"),
    U_TRY("U_TRY", "U先试用"),
    RETROACTIVE_CARD("RETROACTIVE_CARD", "补签卡"),
    PENNY_CONVERSION("PENNY_CONVERSION", "一分兑"),
    WINE_WELFARE("WINE_WELFARE", "名酒福利专场"),
    HOT_SALE("HOT_SALE", "爆款特卖"),
    ;

    private String code;

    private String name;

    ActivityTypeNameCode(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 根据枚举code获取名称
     * @param code
     * @return
     */
    public static String getName(String code){
        ActivityTypeNameCode[] list = ActivityTypeNameCode.values();
        for (ActivityTypeNameCode item : list) {
            if (item.getCode().equals(code)) {
                return item.getName();
            }
        }
        return null;
    }

    public static List<ActivityTypeResponse> getTypeList() {
        List<ActivityTypeResponse> list = new ArrayList<>();
        ActivityTypeNameCode[] typeList = ActivityTypeNameCode.values();
        for (ActivityTypeNameCode type : typeList) {
            ActivityTypeResponse atp = new ActivityTypeResponse();
            atp.setCode(type.getCode());
            atp.setName(getName(type.getCode()));
            list.add(atp);
        }
        return list;
    }

}
